<template>
	<div class="dashboard-container">
		<component :is="currentRole"></component>
	</div>
</template>

<script>
	import { mapGetters } from '/vue/libs/vuex.esm.browser.min.js'
	const adminDashboard = httpVueLoader('/vue/views/dashboard/admin/index.vue');
	const editorDashboard = httpVueLoader('/vue/views/dashboard/editor/index.vue');

	module.exports = {
		name: 'Dashboard',
		components: { adminDashboard, editorDashboard },
		data() {
			return {
				currentRole: 'adminDashboard'
			}
		},
		computed: {
			...mapGetters([
				'roles'
			])
		},
		created() {
			if (!this.roles.includes('admin')) {
				this.currentRole = 'editorDashboard'
			}
		}
	}
</script>
